﻿@model SportsStore.Domain.Entities.Product

@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}

<h2>Edit @Model.Name</h2>
@using (Html.BeginForm("Edit", "Admin", FormMethod.Post, new {enctype="multipart/form-data"}))
{
    @Html.EditorForModel()
    <div class="editor-label">Image</div>
    <div class="editor-field">
        @if (Model.ImageData == null)
        {
            @:None
        }
        else
        {
            <img width="150" height="150" src="@Url.Action("GetImage", "Product", new {Model.ProductId})"/>
        }
        <div>Upload new image:
            <input type="file" name="Image"/>
        </div>
    </div>
    <input type="submit" value="Save"/>
    @Html.ActionLink("Cancel and return to list", "Index")
}